package com.station.administrators.controller;

import com.github.pagehelper.PageInfo;
import com.open.capacity.common.web.Result;
import com.open.capacity.common.model.BusinessModel;
import com.station.administrators.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author YangGang
 * @Title: 商家管理
 * @Description: TODO
 * @date 2021/6/28/14:12
 */
@RestController
@RequestMapping("/bus")
public class BusinessController {
    @Autowired
    private BusinessService businessService;
    @PreAuthorize("hasAuthority('bus:get/bus/findAll')")
    @GetMapping("/findAll")
    public Object findALl(BusinessModel businessModel){
        PageInfo<BusinessModel> businessList =businessService.findAll(businessModel);
        return Result.succeed(businessList,"查询成功");
    }

    /**
     * 审核商家账号
     * @return
     */
    @GetMapping("/examine")
    public Object examine(Long id){
        businessService.examine(id);
        return Result.succeed("审核通过！");
    }
    @GetMapping("/enable")
    public Object enable(BusinessModel businessModel){
        businessService.enable(businessModel);
        return Result.succeed("修改状态成功！");
    }


}
